#import the lib
from arduino import Arduino

import time

#specify the port as an argument
my_board = Arduino('COM1')

#declare output pins as a list/tuple
print "start output configure"
#my_board.init();
my_board.output([13,12,11])

#perform operations
print "start while"
i=5
my_board.setHigh(12)
while(i<10):
    print "setHigh"
    my_board.setHigh(13)
    time.sleep(0.1)
    print "setLow"
    my_board.setLow(13)
    time.sleep(0.1)
    i+=1
i=100
#while(i<200):
#    my_board.analogWrite(13,i)
#    i+=1
#    time.sleep(0.1)
#my_board.analogWrite(13,100)
#time.sleep(10)
my_board.setLow(13)
i=5
while(i<10):
    my_board.setHigh(11)
    time.sleep(0.1)
    my_board.setLow(11)
    time.sleep(0.1)
    i+=1

my_board.setLow(12)

#servo
s  = my_board.getServo(7,0)
s2 = my_board.getServo(6,1)
s.attach()
s2.attach()
print "servo pos:"+s.read()
time.sleep(1)
s.write(120)
s2.write(90)
time.sleep(1)
s.write(70)
s2.write(50)
time.sleep(1)
s.write(40)
s2.write(70)
time.sleep(1)
s.write(90)
s2.write(30)
time.sleep(1)
s.write(30)
time.sleep(1)
my_board.close()